<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : manageUser.xsl
    Created on : May 9, 2013, 12:52 PM
    Author     : NganNLK60334
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:user="http://xml.netbeans.org/schema/user" version="1.0">
    <xsl:output method="html"/>
    <xsl:param name="type" select="'userList'"/>
    <xsl:param name="context" select="'XMLProject'"/>
    <xsl:template match="/">
        <xsl:if test="$type='userList'">
            <xsl:call-template name="userlistcontain"/>
        </xsl:if>
    </xsl:template>

    <xsl:template name ="userlistcontain">
        <div id = "test">
            <table width="100%">
                <tr>
                    <th>Username</th>
                    <th>Fullname</th>
                    <th>Gender</th>
                    <th>Phone</th>
                    <th>Email</th>
                    <th>Address</th>
                    <th>Is Active</th>
                </tr>
                <xsl:for-each select="user:users/user:user">
                    <tr>
                        <td>
                            <xsl:value-of select="user:username"/>
                        </td>
                        <td>
                            <xsl:value-of select="user:fullname"/>
                        </td>

                        <xsl:choose>
                            <xsl:when test="user:gender='true'">
                                <td>Nam</td>
                            </xsl:when>
                            <xsl:otherwise>
                                <td>Nữ</td>
                            </xsl:otherwise>
                        </xsl:choose>

                        <td>
                            <xsl:value-of select="user:phone"/>
                        </td>
                        <td>
                            <xsl:value-of select="user:email"/>
                        </td>
                        <td>
                            <xsl:value-of select="user:address"/>
                        </td>
                        <td>
                            <button>
                                <xsl:attribute name = "username">
                                    <xsl:value-of select ="user:username"/>
                                </xsl:attribute>
                                <xsl:attribute name = "class">
                                    <xsl:text>isActive</xsl:text>
                                </xsl:attribute>
                                <xsl:choose>
                                    <xsl:when test="user:isActive='true'">
                                        <xsl:text>Deactive</xsl:text>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <xsl:text>Active</xsl:text>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </button>
                        </td>
                    </tr>
                </xsl:for-each>
            </table>
        </div>
    </xsl:template>
</xsl:stylesheet>
